#include "Blocks/TorchBlock.h"

namespace PocketSurvival
{
    BlockPlacementData TorchBlock::getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult)
    {
        int32_t value2 = 0;
		if (raycastResult.cellFace.face == 0)
		{
			value2 = Terrain::ReplaceData(Terrain::ReplaceContents(0, 31), 0);
		}
		if (raycastResult.cellFace.face == 1)
		{
			value2 = Terrain::ReplaceData(Terrain::ReplaceContents(0, 31), 1);
		}
		if (raycastResult.cellFace.face == 2)
		{
			value2 = Terrain::ReplaceData(Terrain::ReplaceContents(0, 31), 2);
		}
		if (raycastResult.cellFace.face == 3)
		{
			value2 = Terrain::ReplaceData(Terrain::ReplaceContents(0, 31), 3);
		}
		if (raycastResult.cellFace.face == 4)
		{
			value2 = Terrain::ReplaceData(Terrain::ReplaceContents(0, 31), 4);
		}
		return { value2, raycastResult.cellFace };
    }

	const std::vector<BoundingBox> &TorchBlock::getCustomCollisionBoxes(int32_t value)
	{
		int32_t num = Terrain::ExtractData(value);
		if(num < GET_ARRAY_LEN(BlockConstans::torchCollisionBoxes))
		{
			return BlockConstans::torchCollisionBoxes[num];
		}
		return BlockConstans::zeroCollisionBoxes;
	}

    int32_t TorchBlock::getIndex()
    {
        return Index();
    }
    const std::string &TorchBlock::getBlockName()
    {
        static std::string blockName = "TorchBlock";
        return blockName;
    }

} // namespace PocketSurvival
